//
//  MusicCollectionViewCell.m
//  MMLOOK
//
//  Created by BraveMatch on 15/10/6.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "MusicCollectionViewCell.h"
#import "MyMusicModel.h"
#import "UIImageView+WebCache.h"
#define OffWidth [UIScreen mainScreen].bounds.size.width / 375
#define OffHeight [UIScreen mainScreen].bounds.size.height / 667
@interface MusicCollectionViewCell ()

@property (nonatomic, retain) UILabel *titleLabel;
@end

@implementation MusicCollectionViewCell
- (void)dealloc
{
    [_showImage release];
    [_titleLabel release];
    [super dealloc];
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}


-(void)createSubView
{
    
    self.showImage = [[UIImageView alloc] initWithFrame:CGRectMake(5,5,(self.contentView.frame.size.width - 10)*OffWidth, 200*OffHeight)];
    //self.showImage.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:_showImage];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, self.showImage.frame.size.height + self.showImage.frame.origin.y -40, _showImage.frame.size.width, 40*OffHeight)];
    self.titleLabel.clipsToBounds = YES;
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    //self.titleLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_titleLabel];
    
}

-(void)setvalueWith:(MyMusicModel *)model
{
    [self.showImage sd_setImageWithURL:[NSURL URLWithString:model.pic_url] placeholderImage:[UIImage imageNamed:@""]];
    self.titleLabel.text = model.title;
    

}

@end
